package com.zhanglinfeng.zuul.controller;

import com.zhanglinfeng.api.response.ResultResponse;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ExceptionHandler implements ErrorController {

    @Override
    public String getErrorPath() {
        return "error";
    }

    @RequestMapping(value = "/error")
    public ResultResponse<String> error() {
        ResultResponse<String> response = new ResultResponse();
        response.setCode(500);
        response.setMessage("访问太多频繁，请稍后再访问！！！");
        return response;
    }
}
